<?php

namespace App\Jobs;
use App\Facades\Site;
use App\Jobs\Job;
use App\Models\Personal\Interview;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Sms;


class PersonalInterviewSmsPush extends Job implements ShouldQueue{
    use InteractsWithQueue, SerializesModels;
    protected $companyJobData;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($companyJobData){
        $this->companyJobData = $companyJobData;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(){
        $this->config();
        //获取当前面试记录
        $result = Interview::where('id',$this->companyJobData->interview_id)->first(['status']);
        if($result->status == 0){
            //模板参数
            $smsParam = array(
                'name' => $this->companyJobData->name,
                'company_name' => $this->companyJobData->company_name,
                'job_title' => $this->companyJobData->job_title,
            );
            $smsTemplateCode =Site::get('InterviewNoticeTemp');
            $smsFreeSignName =Site::get('InterviewNotice');
            Sms::codeSend($this->companyJobData->resume_mob,$smsParam,$smsTemplateCode,$smsFreeSignName);
        }else{
            return ;
        }
    }
}
